https://leetcode.cn/problems/binary-tree-paths/
class Solution {
public:
    vector<string> ret;
    void _dfs(TreeNode* root,string path)
    {
        if(root==nullptr)
            return ;
        
        if(root->left==nullptr&&root->right==nullptr)
        {
            path+=to_string(root->val);
            ret.push_back(path);
            return ;
        }
        path+=to_string(root->val)+"->";
        if(root->left)_dfs(root->left,path);
        if(root->right)_dfs(root->right,path);
    }
    
    vector<string> binaryTreePaths(TreeNode* root) {
        string path;
        _dfs(root,path);
        return ret;
    }
};